package com.dwy2002.pojo.vo.product;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import lombok.Data;

import java.time.LocalDateTime;

/**
 * 商品评论返回类
 *
 * @author 杜伟毅
 * @version 1.0
 * @since 2025/02/27
 */
@Data
public class ProductReviewsVO {
    /**
     * 关联的产品 ID
     */
//    private String productId;
    /**
     * 评价用户的 ID
     */
    private String userId;
    /**
     * 评价的评分
     */
    private Integer rating;
    /**
     * 评价的具体内容
     */
    private String comment;
    /**
     * 评价记录创建时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8", shape = JsonFormat.Shape.STRING)
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)        // 反序列化
    @JsonSerialize(using = LocalDateTimeSerializer.class)        // 序列化
    private LocalDateTime createdAt;
    /**
     * 该评论的所属用户
     */
    private UserReviewsVO user;
}
